package com.fary.clazz;

import java.util.Arrays;

public class GetEnclosingClassOfClass {
    public GetEnclosingClassOfClass() {
        //OuterClass在GetEnclosingClassOfClass类的内部 
        //内部类 
        //GetEnclosingClassOfClass-
        class OuterClass {
            public void outerMethod() {
                //InnerClass位于OuterClass类的内部，这意味着
                //InnerClass是OuterClass的内部类

                class InnerClass {
                    public void innerMethod() {
                        System.out.println(getClass().getEnclosingClass());
                    }
                }

                System.out.println(getClass().getEnclosingClass());
                //创建一个InnerClass的实例
                InnerClass ic = new InnerClass();
                ic.innerMethod();
            }
        }

        //创建一个OuterClass的实例
        OuterClass oc = new OuterClass();
        oc.outerMethod();
    }

    public static void main(String[] args) {
        GetEnclosingClassOfClass enclo_class = new GetEnclosingClassOfClass();

    }
}